from django.db import models
import pymysql
# Create your models here.


#第一个用于测试的类
class Book(models.Model):
    uid = models.IntegerField('id',primary_key=True)

#普通用户表
class Mapuser(models.Model):
    uid = models.IntegerField('uid_普通用户id',primary_key=True,)
    username = models.CharField('username_用户名称',max_length=40,)
    mail = models.CharField('mail_用户邮箱',max_length=40,null=True,blank=True)
    phone = models.CharField('phone_用户电话',max_length=15,null=True,blank=True)
    password = models.CharField('password_用户密码',max_length=20,null=True,blank=True)
    vcode = models.CharField('vcode_临时验证码',max_length=10,null=True,blank=True)
    giteeid = models.IntegerField('giteeid_第三方id',default=0)
    class Meta:
        verbose_name = 'Mapuser_普通用户'   #admin中 显示的表名

#编辑者用户表
class Editer(models.Model):
    uid = models.IntegerField('uid_编辑者id',primary_key=True,)
    username = models.CharField('username_编辑者名称',max_length=40,)
    token = models.CharField('token_用户token', max_length=200, default='none')
    mail = models.CharField('mail_编辑者邮箱',max_length=40,null=True,blank=True)
    phone = models.CharField('phone_编辑者电话',max_length=15,null=True,blank=True)
    password = models.CharField('password_编辑者密码',max_length=20,null=True,blank=True)
    vcode = models.CharField('vcode_临时验证码', max_length=10, null=True, blank=True)
    giteeid = models.IntegerField('giteeid_第三方id', default=0)
    class Meta:
        verbose_name = 'Editer_编辑者'

#记录表
class Mfile(models.Model):
    uid = models.IntegerField('uid_用户id',primary_key=True,)
    token = models.CharField('token_用户token',max_length=200,default='none')
    mdfile = models.TextField('mdfile_修改档案',default='{}')
    ltime = models.CharField('ltime_最后修改时间',max_length=50,default='2000-01-01 00:00:00')
    chlist = models.TextField('chlist_检查表记录',default='[]')
    class Meta:
        verbose_name = 'Mfile_记录表'




#游戏表
class Game(models.Model):
    id = models.IntegerField('id_游戏id',primary_key=True)
    name = models.CharField('name_游戏英文名',max_length=50,default='noname')
    title = models.CharField('title_游戏中文名',max_length=30,default='未命名游戏')
    img = models.CharField('img_游戏封面路径',max_length=100,default='https://kb.violet-umberto.com/3705af23-5acb-4cc2-a7dd-64abae424b76')
    bg_url = models.CharField('bg_url_背景链接',max_length=100,default='-')
    color = models.CharField('color_颜色',max_length=30,default='green')
    class Meta:
        verbose_name = 'Game_游戏表'

#地图表
class Map(models.Model):
    id = models.IntegerField('id_地图id',primary_key=True)
    name = models.CharField('name_地图英文名',max_length=50,default='noname')
    title = models.CharField('title_地图中文名',max_length=30,default='未命名地图')
    img = models.CharField('img_地图封面地址',max_length=100,default='https://kb.violet-umberto.com/3705af23-5acb-4cc2-a7dd-64abae424b76')
    size_w = models.IntegerField('size_w_地图尺寸宽',null=True,blank=True)
    size_h = models.IntegerField('size_h_地图尺寸高', null=True, blank=True)
    color = models.CharField('colcr_地图颜色',max_length=30,default='green')
    layerurl = models.CharField('layerurl_拼图路径',max_length=100,default='/')
    layers = models.IntegerField('lyers_地图层数',default=1)
    gid = models.IntegerField('gid_游戏id',default=0)
    class Meta:
        verbose_name = 'Map_地图表'

#大类表
class Group(models.Model):
    id = models.IntegerField('id_大类id',primary_key=True)
    name = models.CharField('name_大类英文名',max_length=50,default='noname')
    title = models.CharField('title_大类中文名',max_length=30,default='未命名大类')
    mid = models.IntegerField('mid_地图id',default=0)
    issurvival = models.BooleanField('issurvival_是否存活', default=True)
    class Meta:
        verbose_name = 'Group_大类表'

#小类表
class Category(models.Model):
    id = models.IntegerField('id_小类id', primary_key=True)
    name = models.CharField('name_小类英文名', max_length=50, default='noname')
    title = models.CharField('title_小类中文名', max_length=30, default='未命名小类')
    iconurl = models.CharField('iconurl_图标路径',max_length=100,default='/')
    shadowurl = models.CharField('shadowurl_图标背景路径', max_length=100, default='/')
    cluster = models.BooleanField('cluster_可聚合',default=False)
    status = models.BooleanField('status_状态', default=False)
    grid = models.IntegerField('grid_大类id',default=0)
    issurvival = models.BooleanField('issurvival_是否存活', default=True)
    class Meta:
        verbose_name = 'Category_小类表'

#点表
class Point(models.Model):
    id = models.BigIntegerField('id_点id',primary_key=True)
    type1 = models.CharField('type1',max_length=20,default='FeatureCollection')
    type2 = models.CharField('type2', max_length=20, default='Point')
    type3 = models.CharField('type3', max_length=20, default='Feature')
    x = models.FloatField('x_横坐标',default=0)
    y = models.FloatField('y_纵坐标',default=0)
    title = models.CharField('title_点名',max_length=30,default='noname')
    content = models.TextField('content_点内容',default='未编辑内容')
    img = models.CharField('img_点图片路径',max_length=100,default='https://kb.violet-umberto.com/3705af23-5acb-4cc2-a7dd-64abae424b76')
    cid = models.IntegerField('cid_小类id',default=0)
    issurvival = models.BooleanField('issurvival_是否存活',default=True)
    class Meta:
        verbose_name = 'Point_点表'

#地区表
class Region(models.Model):
    id = models.IntegerField('id_地区id',primary_key=True)
    title = models.CharField('title_地区名',max_length=20,default='-')
    x = models.IntegerField('x',default=0)
    y = models.IntegerField('y',default=0)
    mid = models.IntegerField('mid_所属地图',default=0)
    issurvival = models.BooleanField('issurvival_是否存活', default=True)
    class Meta:
        verbose_name = 'Region_地区表'



#图标表
class Icon(models.Model):
    iid = models.IntegerField('iid_图标id',primary_key=True)
    img = models.CharField('img_图标路径',max_length=100,default='/')
    gid = models.IntegerField('gid_所属游戏或分类',default=0)
    class Meta:
        verbose_name = 'Icon_图标表'

#图标类表
class Iconclass(models.Model):
    id = models.IntegerField('id_图标类id',primary_key=True)
    title = models.CharField('title_图标类名',max_length=30,default='')
    color = models.IntegerField('color_类别颜色0黑1白',default=2)
    class Meta:
        verbose_name = 'Iconclass_图标类表'







#事件类别表
class Todocategory(models.Model):
    id = models.IntegerField('id_事件类别id',primary_key=True)
    title = models.CharField('title_事件类别名称',max_length=30,default='')
    gid = models.IntegerField('gid_所属游戏id',default=0)
    class Meta:
        verbose_name = 'Todocategory_事件类别表'

#事件表
class Todo(models.Model):
    id = models.IntegerField('id_事件id',primary_key=True)
    title = models.CharField('title_事件名称',max_length=30,default='')
    classid = models.IntegerField('classid_所属类id',default=0)
    classtitle = models.CharField('classtitle_所属类名称',max_length=30,default='')
    gid = models.IntegerField('gid_所属游戏',default=0)
    mid = models.IntegerField('mid_所属地图',default=0)
    mtitle = models.CharField('mtitle_所属地图名',max_length=30,default='')
    info = models.TextField('info_事件详情',default='未编辑内容')
    pointurl = models.CharField('pointurl_点链接',max_length=100,default='')
    class Meta:
        verbose_name = 'Todo_事件表'

#检查表列表
class Checklist(models.Model):
    id = models.IntegerField('id_检查表id',primary_key=True)
    title = models.CharField('title_检查表名字',max_length=30,default='未命名表')
    gid = models.IntegerField('gid_所属游戏',default=0)
    class Meta:
        verbose_name = 'Checklist_检查表列表'

#检查事项表
class Check(models.Model):
    id = models.IntegerField('id_检查事项id',primary_key=True)
    lid = models.IntegerField('lid_所属列表id',default=0)
    content = models.TextField('content_字段内容json',default='{}')
    class Meta:
        verbose_name = 'Check_检查事项表'